﻿@{
    ViewData["Title"] = "修改密码";
    Layout = "_Edit";
}

<article class="page-container">
    <form action="" method="post" class="form form-horizontal" id="form-add">
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>旧密码：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <input type="password" class="input-text" value="" placeholder="" id="oldPWD" name="oldPWD">
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>新密码：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <input type="password" class="input-text" value="" placeholder="" id="pwd" name="pwd">
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>确认密码：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <input type="password" class="input-text" value="" placeholder="" id="ncPwd" name="ncPwd">
            </div>
        </div>
        <div class="row cl">
            <div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-3">
                <button type="button" class="btn btn-success radius" onclick="updatePwd();" id="admin-role-save" name="admin-role-save"><i class="icon-ok"></i> 保存</button>
                <button type="button" class="btn btn-success radius" onclick="closePageLayer(false);" id="admin-role-save" name="admin-role-save"><i class="icon-ok"></i> 关闭</button>
            </div>
        </div>
    </form>

</article>

@section javascript {
<script type="text/javascript">
    function updatePwd(){
        var oldPWD=$("#oldPWD").val();
        if(oldPWD==null||oldPWD=="")
        {
           popupAlertEza('旧密码不能为空');
           return;
        }
        var nPwd=$("#pwd").val();
        if(nPwd==null||nPwd=="")
        {
           popupAlertEza('新密码不能为空');
           return;
        }
        var ncPwd=$("#ncPwd").val();
        if(ncPwd==null||ncPwd=="")
        {
           popupAlertEza('确认密码不能为空');
           return;
        }
        if(ncPwd!=nPwd)
        {
           popupAlertEza('两次密码不一致，请重新输入！');
          return;
        }
       SubmitFormForAjax("/home/updateuserpwd", $("#form-add").serialize(), function (data) {
           if (data.result) {
                   popupAlertFu('修改密码成功',1,function(){closePageLayer(false);});
           }else{
               popupAlertEza(data.message);
           }
       },true);
    }
</script>
}
